package org.jackysoft.entity.nosql;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import javax.persistence.Transient;

import org.jackysoft.annotations.FieldType;
import org.jackysoft.annotations.Form;
import org.jackysoft.annotations.FormElement;
import org.jackysoft.annotations.FormEncType;
import org.jackysoft.entity.nosql.AbstractNoSqlEntity;


@Form(id = "NewsInfoForm", label = "NewsInfo编辑", enctype = FormEncType.NORMAL)
public class NewsInfo extends AbstractNoSqlEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1151928210491227135L;

	public NewsInfo() {

	}

	private Calendar updateDate;
	
	private String name;
	
	private Date createDate;
	
	private String fullPath;
	
	private String webPrefix;
	
	private String catalog;

	private String relativeUrl;
	
	/**
	 * @return the name
	 */
	@FormElement(id="name",name="bean.name",label="名称",type=FieldType.textfield)
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the fullPath
	 */
	public String getFullPath() {
		return fullPath;
	}

	/**
	 * @param fullPath
	 *            the fullPath to set
	 */
	public void setFullPath(String fullPath) {
		this.fullPath = fullPath;
	}

	/**
	 * @return the catalog
	 */
	@FormElement(id="name",name="bean.catalog.id",label="分类",type=FieldType.select)
	public String getCatalog() {
		return catalog;
	}

	/**
	 * @param catalog
	 *            the catalog to set
	 */
	public void setCatalog(String catalog) {
		this.catalog = catalog;
	}
	
	@Transient
	public String getDate(){
		SimpleDateFormat df = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
		if(this.getCreateDate()==null)return "";
		return df.format(this.getCreateDate());
	}

	public void setRelativeUrl(String relativeUrl) {
		this.relativeUrl = relativeUrl;
	}

	public String getRelativeUrl() {
		return relativeUrl;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Calendar getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Calendar updateDate) {
		this.updateDate = updateDate;
	}

	public String getWebPrefix() {
		return webPrefix;
	}

	public void setWebPrefix(String webPrefix) {
		this.webPrefix = webPrefix;
	}
}